Fix pods_str_replace so it properly handles arrays and objects