Fixed one bug for Serial Scan by key code + changed map/unmap code + some offset test cases