Fixed bounding box code