Fixes aws not defined error

Fixes #969.