Fix for #1 and #52 [#1 status: fixed][#52]