Fixed compatibility issues with `Reflection` API, small refactoring