more minor modifications and bug fixes