cleanup and stability fixes