Fixes to txbuffermanager (nullpointer error) and changes to inputstream to improve performance