various style fixes, bug fixes, etc.