trying to fix error from error log; how can amttopay be undefined?