Fixed referencing error when deleting old files