returning "2" error code in case of communication failure