Fixed wrong cast in unattended keystore, and a new validation method to validationutils