Some minor changes and bug fixes