Random NULL and errorHandler

Fixed random NULL appearing (probably from using exit somewhere)

Now an error will be shown, type hinting in errorHandler broke some things. I tried to fix it with the global namespace but this would not work.