Fixed issue with casting