fixed function isempty bug