Check for null target. Fixes #22