Fixed so the program never crashes while deleting buffers