Was wrong, error checking must be before statement closure.