Fix bug where remove method on list head raises attribute error