Fixed msg_key check