Use sed instead of bash's replace

bash replace doesn't work sometimes