fixed code for failing tests