Fix state->max_msg being read and written to within same statement.
Merge pull request #3 from bwegge/fix-undef

Fix state->max_msg being read and written to within same statement.