Fixed setting x or y position to +-Infinity

Fixes #225.