Added the check function for make suer the file exists and executable