Fixed the OTF algorithm