Fix bug in using string variable to access map key