fix #629 and add some warnings