compatibility fixes for old matplotlib and numpy versions