Added substr to bookengine.php