fixing some permissions issues and a dodgy template