fixed edge cases (literally)