fix for duplicate end