add some refurence and pattern match issue