Fixing bug following code review