error stream functions and bug fixes