bug fixes; thanks for the beer ian