variable check and styling

Check a variable set_act before attempting to use it. Code styling
updated for spacing.