Avoid crashes when setting nil for scalar values
Reorder methods