Move hascmd and pathcmd to earlier in shlib