modify insertAfter() to handle tail end case