Fixed bug in insertMarkup