Add AUTH tests and fix a bug