Fix ports binding bug
Fix various issues

- not passing stage to functions
- not outputting logs
- fix tests