Fixed compiler warnings due to unsafe type conversions.