Fix buggy position computation

Fixes GH-152.