Revert "Fix compile errors and incorrect variables"

This reverts commit d5d9d9c9512bae45c1c7724694020c045d894ecf.