fixing 500 error when not logged in

Fixes #1406.