added tests and fixed warnings