fixes issue #297, another approach

As stated in #298 here is another approach to fix #297.