fix database connection bug
fix redirect bug on duplicate login