check for null scope

fixes #5