add casts to silence gcc warnings