Fixed problems by bodged merge