Fixes the functional tests. Now everything passes. Added an option to set PORT as environment variable.