fixed bug for from func