added null check for location.  fixes #1