Make rails 4.1 compatible & fix specs