upgraded to rails 4

some improvements and fixes