Fixed a bug that could raise a "No method for nil" exception.