Fixes for bugs #55 and #54