fixed #61: NPE due to race condition