Added error file logging when a stream is overdrawn, and added a test-case to check validity.