fixed a bug in selftest mode