updated code to fix tests