add hashmap, corrected npe