Bug fixes, minor changes