Fixed error with multithreading vs. session