fixed redirect bugs
fixed db_init