fixed bug in legend file reader.