Fix known bugs so far (LUCENE-5817, LUCENE-5818)