Fixed session and redirect issues