Fixes a bug that prevented showing the legends when using createLayer