Make valid() return a boolean instead of 0 or 1. Fixes #109 - valid() does not return boolean value