fixes #4706 Key Value field creates error Ooops sorry

Fixed the issue and pushed the code for review, please check it.