Type cast bug fixed