Fixed issue with exception throwing

Signed-off-by: Ozan Turgut <ozanturgut@gmail.com>