add read_query_alignment function; bug fixes