Fix type of elements correctly