fixing authentication and permission system