works with single-byte keys