fixed undefined method .empty error