Fixed and improved tests