Various fixes

- restore performance optimization to reduce wrapping 
- restoring null check removed in recent commit