small logic bug