Minor code fixes

thought the logic wasn't exactly right and thought "whatever I'll fix it".