Fix some bugs in the new rake build process