Fixes bugs and improves stability.