error handle for key size