Checking for correct error code, TODO: fix int nelems to integer*4