Fixed errors in grad descent code;