fixes for ticket #1 and ticket #2