bug fix on isEmpty method