clean up. fix #1, #3