Fix a bug in cust() and sim()