fixed issues:
- pushing to nil array.
- simplified inject