small but important changes to J computation