Fix handling of optional labels

Fix #28