Make sure $HEAD is a string before appending to it