Fix postgres and redis port detection