added some login middleware
fixed some conflicts