added validation and fixed soem errors