generateKey() corrected