Fixing uithreading problem