Fix update query regression

A regression was introduced with a previous merge that breaks any updates where a value is null. This patch adds a test for the condition, and a fix.