Use setTimeout() to disable buttons before generating keys.