added some casting functions