various niteroperability fixes (issue #5221)