Fixed off-by-one error when trying to cast attribute to ascend

This fixes the bug described in #843
Typo fix in comments

completelty => completely