fixed error code bug