fixed advanced funciton