fixed a number of issues after using the code last night