fix bounds calculation