Correcting crash + converting to int