fixed to work with rails