Performance and stability fixes