Various stability fixes

Agent now reconnects after error.
Fixed error in module sendNotice and sendAction.