fixed and updated code causing failed tests