fix env, file perms and update scala