fix memory issue with rake task