fixes #718

This change was unrelated to the actual fix, but I noticed that I could simplify this function.