fix nil exception when using with rails 4