Fixed errors for statement handle, also added deactivate function