added packet validation