Fixing authentication code