Fix some inconsistent behavior and a possible issue with adding a GUI element twice