first iteration bug fix