added tests and made exception is more specific
added tests and made exception is more specific