fix badmatch error