minor modifications and bug fixes