bug fix after code's improvements