cleanup, bug fixes