Added some warnings and asserts