casting int as long to fix xcode warning