Bugfix

This way is cleaner and probably won't crash on Mac.