reworked retrieving of inputstream - first try error stream and if not available try with input stream