Added some casts to keep the compiler from complaining.