Fixed some bugs around inserting <p> tags instead of <div>