Fix error in primitive handling