Fixed pull request

Last pull request was broken, this one actually fixes the null pointer exception