bugfixed in charst detect functn