improve #isEmpty implementation.  add 2 tests
(cherry picked from commit 130e860ecf2f42bddf503cb603d8e2f2661034db)