added conditional to check if dictionary key exists, fixes #482