cleanup and resolve some issues