Fix database module
Fix compiler for new permission system
Final fix of permissions system

At least as far as I can tell