bugs fixed except logout doesn't direct to correct page