Before bug

@alexwolfe merging this in to [develop] .. you should still take a look but it seems to work