Fix legend overlay issue