fixed #141 moved null-setting after local optimizations