Fix apt errors and some mkdirs