Bug fix to incorrect use of empty()