Fixing a bug in heat map