change order of check in unistall function