Fixed bug in key parsing