fixed deadlock and Owins logic