fixed data casting bug