Some errors fixed, script fails on line 218 with exit status 1