fix several remaining markdown generation bugs