handle val < 0 problem