bug fixes

Fix: There was a crash happening after the script ran.