fixing formatting and error codes for reading mailbox