add more validate to avoid notice and warning in php log
fix bugs