added bind and environment and debug to check the environment