fixing PIN storage and added missing unique on username to DB structure