Small improvements for inputStream handling.