corrected a bug introduced by 'fix #5' PR, the if db.contains_key is
mandatory