Fixed the tip calculation