fixes most errors, dtask func, array formats