Cast bugfix