fixing errors when using substr in client