fixes head to be valid