Fixed is_empty method