File.realpath does not exist in ruby 1.8.7, changed to use File.expand_path instead