fixed bug where error was not being thrown