get rid of two cast warnings