Fix some warnings and add a new test