fixed bug with state callback not being passed