Fixed file loading bugs