Minor reflection side effect bugfix.
Although strangely the code seemed to work before this fix even though it was wrong and failed when this code runs standalone.