fixed bug when didn't display correct error code