fixed extracting code for SA and CA