Fixed potential NPE thrown in AbstractConsumer + some code improvements