Changed checking packages section in script (to be first)