fix conversion warnings by explicit casts