Tests and bugfixes for cgpt next