fix added code not in when-let block