Move NULL-check (fixes #8)