insert the created directory to the front instead of the back
provide better information when error occurs