mermaid patch fix: getDirection and setDirection in stateDb refactored to return and set actual direction