Fix handling of primitive values, fixes #174