Fixed the new algo so it works again