More generic fix for hiding rectangle