Fixed wrong filename substring (reported in #319)