Fix invalid context error

see issue  #44