lib: cleaned up casting to unsigned int