fixed a whole range of issues