Fixed small bugs caused by previous enhancements.