Added null check, fixes #66