fixed runtime errors but head is not being set