need to check for null, otherwise it will throw error on first run when ...

title says it all :)