bug fix for NPE