Typo and small logic fix