explicit type cast to int added to avoid compiler warnings