Add nil checks
Merge branch 'master' into gh-pages