Fix sed command incompatibility issues (different -i option behaviour on mac and linux)