Fixed orphan record issue with a rake task remove_orphan