modification, still errors in receiving data. reproduced in console.read method