Fix IndexError issue #11

Fix for issue #11