very minor bug fixes, comment and code improvements