bug fixes and a few more comments

bug fixes and a few more comments