fix limit logic