Fix #525 & #528

Squashed version of https://github.com/eslint/eslint/pull/529