Fixed/added tests, based on Vasia's feedback