added casting -1 as (unsigned long)