Fix some bugs/errors.