Fix lint errors

Greetings,
r was out of scope in the while condition, not sure how that could work. Also added the safer === instead of ==