changed #ifdef legend