Fixed wrong order of where and optional match