move checkdir to utils