Use correct types for the arguments to ReplaceAll