Properly handle BOOL in encodeValue(), see #84