Empty tail problem, almost fixed.
Fixes empty list problem.