wrap function for deriv
Better sign function
fixed pix