add check to scanf