Bugfixes to spatial transformations