Template fixes

See the changes on heroku http://kopentavern.herokuapp.com/
This while if check is counterproductive as we should let this be duck typed so we can allow pluggabel user models. Not part of this PR, so we can fix this later.