pep8 improvements and deserialization fix