fixing error capture