Fixes weird lifecycle issues.