added index prepare and script hooks