Few fixes according to Marcin's code review.