fix small repeated code