Added a simple null check (took me too long actually >.>). May not work 100%