bug fixes and style guide cleanups