some improvements for errors handling on client side