Fixed COM calculation