fixing and adding tests