working on error codes, bug