More bug fixes: #419, #286

fixes #419