fix for issue #75
changes to get legend for issue #37, needs testing