remove needless pattern matching