fix block/inline discrimination
fix document order bug