fixed programcounter and added some tests