Fixed substr offsets, added parameter reset