bug fixes on close