R: small changes and a test