fix error while empty array as input in reactionkey()