Fixed #141. When refactoring, some code had been duplicated.