fixed bug with initially null userState