Some bugfixes and additions.