simpler validation, fixes some segfaults :D