fixed proper status error code to be returned