Strange nullpointer exceptions, maybe this will fix it