Unterminated function fix

This bug was reported in #58 by @iceicetimmy