fix .head for errors and add test