Fix bug for primitive types