adding static_cast to suppress gcc 4.1.2 compile warning