-Fixed resource locking dead-lock bug