bug fix (checking uint for val<0)