some minor bug fixing and validation fun