Fixed a bug and adapted test