JPM/HM: took care of interesting edge cases (tested in SolrServerTest)