Removed debug code
Fixed compatibilty with rails < 4.0