fix value casting