fixed signal handling bug