fixed implicit conversion warnings by adding casts