fix bounds trimming