Fixing rake script to work with new schema