Added casts to silince the warnings from compile.