Fix huge bug in getFramesNeeded!