don't use EOF as default value for insertafter

This patch fixes issue #4700.