Fixed compile problems after adding valid.h