fixes 248

here is a second attempt to fix 248 let me know what you think