fix #167 changed sub to substr