Fix handling of scalars