fix bug passing filename around