bug fix in error code