minor changes: initialize conn and ser to None, some PEP8 stuff