added in some error codes for better debugging