Fix inheritance of individual contexts

Squashed commit of the following:

commit a81955b08938a925779f9f7c6d693c08eace5620
Author: Jonasz Grochowski <tensaioni@gmail.com>
Date:   Thu Jul 31 14:08:17 2014 +0200

    Add fixes to controller and model + tests