fixed more bugs. Properly implemented reception of data from client side