Fixed the remove empty bug