Fixed and added new tests