Set $ok at the beginning of the function; this variable is missing is case of failure...