bug fixes to input stream and some UI bugs