bug fixes

Added title field to select query, assorted other bug fixes