fixed a bug in signal funcion