Fix bug with tipping function