fix testing function