Fix missing imports + terminate salt process only when necessary