valid checker, minor bug fixes