add `optional` flag for params