fixing deadlocks (failure to wakeup condition) , memory overruns and deadlocks
adding more debug info
adding a better parser for the CSV/ARRAY data and fixing some memory errors