added on more setwd(), and a missing system()