bug fix for wrong range in sql and missing letters