Rewritten NBSInputStream so it's less stupid