Little bugfixes, and this is now tested to work also physically.