replace define by a proper function