code cleanup, bug exist