Fixing the problem with HEAD insertion