Bugfix session form state handler

Fixing collision problem with formstate id. Also, improving garbage collection.