Fix exception handling due to confusing exception naming

There exist two exception classes with the same name. Due to that confusing
construct one of these exceptions was not handled properly. This patch re-organizes
these exceptions and rename both to avoid future confusion.