Fixed incorrect handling of NULL values, as reported by Stephane Wustner.