some casting fixes