added __dirname, removing repo and scripts directories, cleaning pending builds on start