Fixes NullReferenceException in #186. Didn't work the way it was supposed to anyway.