fixed wrong cast