Fixed queue in order to work properly with threads, thx cortex :)