Fixed a bug in eq and added more tests