bugfix related to #29 (access to invalid memory)