stat counters + added more error handling