fix some warnings
add simple validation