improved null and double quote handling