Fixes to models and base.html