finish casting + fix errors