Issues #395 and 551 fixed