Simplify usage of promises
Fix wrong port in tests which were causing them to fail