A few more fixes.

 * Fix class cast exceptions
 * Since, given a map `x =  {a -> null}`, `x[a] = null` and `x[b] = null`, it seems reasonable to just drop hash keys that have null values.