Some fixes and extensions.