fixed a bug with 0 length keys