Fixed process of targets to build
Handled errors in magic task