bug in the bounding rectangle calculation