Bug fixes and stability improvements