Fixed small bugs; removed compiler warnings.