fix minor bug and code review requests