Eric's bug fixes