upgrade to rails 4 and fix login bugs