some improvement for portability