Fixed some issues with engine startup/shutdown logic