backport fixes in https://github.com/jbevain/mono.reflection/commit/8890c4cf0d3bb1b2b48cf5e03a93e396ee292e7a