Hopefully fixed casting