Bug fixes for escaping quotes and handling NULLs.