fixed memory leak in cleanBuffers and FP miscalculations