Fixed error reporting problem