Fixed error when opening file