Fix bug in FOS calculation