fix the before code