Bugfix + added buffering to packet output