change the sed command, sed -i is not compatible with OSX
remove unnecessary lines