add check valid method