fixed some issues mentioned in code review