Added condition to check key existnace