bug with final state fixed