fix error when element is removed and alwaysVisible is set to false
0.5.6