Bug fixing for tasks #119 and #120.