Fix issue regarding padding for bounding rectangle