Fixes for DynamicCode and tests