Fixed issue #13 and issue #11