Bug fixes and lifecycle tweaks