fixed cast bug