Fixes #34: Change initialization sequence

- Added a test to verify the bug and its fix