improvements in pattern convertion