replaced runtime exception with proper exception