few bugfixes for proper error headers; added search methods to database wrapper