make buffers able to be loaded from files and fix some bugs