handle destroying and rebuilding UIs
fixed check for correct UI element
#314 - PRE#removeGUI is buggy