Fixed errors with __main__ clean up