Fixed pointer casting problem