Fixed an issue with improper error code being returned