Fixed multithreading issue (i hope -_-)