Fixes #1 and probably more issues