fixed jquery bug
bug fix in storing of final state