Fix 'return wrong number when the key is empty' bug