Added changes to a slot to try and eliminate a bug that crashes the program.