assignment4 bugs correction