fixed Issue #41 (Uncaught Type Error)