fixing substr