Fixed bug in delete gui code