Minor logic bug fix