Make Rakefile much more robust