Fixed psi+ build warnings about unused variable and reordering variables