Rails4 defect fixes