fix check for complete and cleanup. #185