use with block to avoid deadlock