Fixed small error cases