Fix bug in labelmap apply