Fixed possible dead lock