Fix and use source index for hashmap
Fix wrong input
Fixed typo