fixed all occurrences of toMap