improved the GC count function