Fix conflict of enter/exit prereqs on same state

Cleanup the used prereqs result to avoid confusion in function prereqs()
on next transition. Added a test for that.