fix bugs in parsing triggered by code misinterpreted as markup; improve option handling