Error handling, improper serial number handling, and other fixes