fixing errors found in code review. thanks @barapa.