Fix bug in gateway parsing. Closes #9.